-
Notifications
You must be signed in to change notification settings - Fork 167
propagate parent tag context downward to improve runtime #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
propagate parent tag context downward to improve runtime #191
Conversation
a5b09f1
to
b48c482
Compare
b48c482
to
f9efec0
Compare
Signed-off-by: chrispy <chrispy@synopsys.com>
f9efec0
to
9848a04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Refactoring the ['pre', 'code', 'kbd', 'samp']
list into _noformat
makes sense. Is this the change that speeds up #162? Lets go!
Ah, one last thing: the readme examples for the custom converters still have the |
caf0ec9
to
02a2bca
Compare
Signed-off-by: Chris Papademetrious <chrispy@synopsys.com>
@AlexVonB - good catch on the README.rst file, thank you! This pull request improves runtime for hierarchically deep HTML structures (as opposed to #186, which improves runtime for broad flat HTML structures). @AlexVonB , @AlextheYounga - this branch now includes #186. I did some local correctness and performance testing, but I would appreciate any additional testing you can provide so we can merge this in confidence. |
@AlexVonB, @AlextheYounga - I had one more look through the code and felt pretty good about it, so I merged it. |
Fixes #190.
Improves runtime by propagating the parent tag context downward into children. Python
set()
objects are used because membership tests are fast and deduplication is automatic.In addition, the following "pseudo-parent" parent tag names are propagated:
_inline
- parent include a heading,td
, orth
tag_noformat
- parents include apre
,code
,kbd
, orsamp
tagFor one of my large HTML testcases that has
<div>
,<article>
, and<section>
hierarchy, runtime improves from 502 seconds to 261 seconds.This pull request changes the interface for
convert_*()
functions by changing theconvert_as_inline
Boolean parameter to aparent_tags
set parameter, so this change should probably be made in a major version number change.